/********************************************************************
	Created:	2011/02/22    16:43 
	Filename: 	Render2D.h
	Author:		falconwang
*********************************************************************/

#ifndef Render2D_H__
#define Render2D_H__

#include "VisCommon.h"

namespace Vis
{
	class Camera;

	class Render2D
	{
	public:

		static Render2D* Instance()
		{
			static Render2D self;
			return &self;
		}

		~Render2D();

		// Init and Release
		void	InitOpenGL();
		void	FreeRender();
		void	SetCamera(Camera* cam);

		// Rendering
		void	BeginRender();
		void	EndRender();
		void	SwapBuffers();

		// clip use stack to mix all clips.
		void	SetClip(int x, int y, int w, int h);
		void	ResetCurClip();
		// bool GetCurClip(rect& _rect);
		void	ClearAllClips();

		// draw function
		void	DrawLine();
		void	DrawRect();
		void	DrawTriangleList();
		void	DrawIndexedTriangleList();

		// texture management

		// rendered texture management

	private:

		// clip
		void	SetScissor(int x, int y, int w, int h);

		Render2D();
		Render2D(const Render2D& _other);
	};
}

#endif // Render2D_H__